﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.IO;

namespace TfsExtensions.Build.Activities
{
    public sealed class CleanWorkingFolders : CodeActivity
    {
        [RequiredArgument]
        public InArgument<string> WorkingFolderName { get; set; }

        protected override void Execute(CodeActivityContext context)
        {
            var folderPath = this.WorkingFolderName.Get(context);

            if (Directory.Exists(folderPath))
            {
                Directory.Delete(folderPath, true);
            }
        }
    }
}
